home *** CD-ROM | disk | FTP | other *** search
/ Champak 25 / Volume 25 - JOGO DISK .iso / Games / the_jewel_hunter.swf / scripts / Bike.as next >
Text File  |  2006-06-13  |  2KB  |  75 lines

  1. classBike = function()
  2. {
  3.    this.init();
  4. };
  5. classBike.prototype = new MovieClip();
  6. Object.registerClass("Bike",classBike);
  7. classBike.prototype.init = function()
  8. {
  9.    thisholder = new Object();
  10.    this.mc.gotoAndStop(random(this.mc._totalframes) + 1);
  11. };
  12. classBike.prototype.update = function()
  13. {
  14.    var _loc1_ = this;
  15.    _loc1_._y -= _loc1_.yspeed;
  16.    if(_loc1_._y < -30)
  17.    {
  18.       _loc1_._parent.bikeCount -= 1;
  19.       removeMovieClip(_loc1_);
  20.    }
  21.    for(var _loc3_ in _loc1_._parent)
  22.    {
  23.       var _loc2_ = _loc1_._parent[_loc3_];
  24.       if(_loc2_._name != _loc1_._name)
  25.       {
  26.          _loc1_.check(_loc2_);
  27.       }
  28.    }
  29. };
  30. classBike.prototype.smoke = function()
  31. {
  32.    var _loc1_ = this;
  33.    if(Game.player.mc._y < _loc1_._y && !_loc1_.isOver)
  34.    {
  35.       _loc1_.isOver = true;
  36.       snd.play("snd_over");
  37.    }
  38.    var _loc3_ = _loc1_._parent._parent._parent.effect;
  39.    _loc3_.count = _loc3_.count + 1;
  40.    _loc1_.count = _loc1_.count + 1;
  41.    if(_loc1_.count % 8 == 0)
  42.    {
  43.       var _loc2_ = _loc3_.attachMovie("smoke","s" add _loc3_.count,_loc3_.count);
  44.       _loc2_._x = _loc1_._x;
  45.       _loc2_._y = _loc1_._y + (random(10) - 5);
  46.       _loc2_._xscale = _loc2_._yscale = random(50) + 50;
  47.    }
  48. };
  49. classBike.prototype.check = function(obj)
  50. {
  51.    var _loc1_ = this;
  52.    var _loc3_ = obj;
  53.    var yrange = _loc1_._y - _loc3_._y;
  54.    var _loc2_ = undefined;
  55.    if(yrange < Math.max(50,(_loc1_.yspeed + Game.speed) * 5))
  56.    {
  57.       if(_loc3_._x < _loc1_._x)
  58.       {
  59.          _loc2_ = _loc1_._x - _loc3_._x;
  60.          if(_loc2_ < 40)
  61.          {
  62.             _loc1_._x += _loc1_.xspeed;
  63.          }
  64.       }
  65.       else
  66.       {
  67.          _loc2_ = _loc3_._x - _loc1_._x;
  68.          if(_loc2_ < 40)
  69.          {
  70.             _loc1_._x -= _loc1_.xspeed;
  71.          }
  72.       }
  73.    }
  74. };
  75.